﻿using LitJson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class FlyItem:Item
{
    public int flyItemID { get { return m_FlyItemID; }set { m_FlyItemID = value; } }
    public float shotRange { set { m_ShotRange = value; }get { return m_ShotRange;} }
    public float explotionScale { set { m_ExplotionScale = value; } get { return m_ExplotionScale; } }
    int m_FlyItemID = 0;
    float m_ShotRange = 11;
    float m_ExplotionScale= 0.5f;

    public override JsonData Save()
    {
        JsonData root = new JsonData();//base.Save();
        //root = SavePrefab(root);
        root["FlyItemID"] = m_FlyItemID;
        root["IconPath"] = iconPath;
        return root;
    }
    public override bool Load(JsonData json)
    {
         base.Load(json);
        LoadPrefab(json);
        IDictionary<string, JsonData> jsond = json.ValueAsObject();
        if (jsond.ContainsKey("FlyItemID"))
            m_FlyItemID = jsond["FlyItemID"].ValueAsInt();

        return true;
    }
    public virtual float CalcMass()
    {
        m_Mass = MathF.Sqrt(volume / 100000) * (7800f / 1000f);
        return m_Mass;
    }


    public static float CalcChargeMass(float chargeQuantity)
    {
        return chargeQuantity / 1000;
    }
}